home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
089a.dms
/
089a.adf
/
TEXTS
/
CHAPTERS_1-10
/
Chapter02.txt
< prev
next >
Wrap
Text File
|
1992-03-06
|
3KB
|
67 lines
The Absolute Beginners Guide To Amos
-------------------------------------
Chapter Two
-----------
Before we continue on to more commands there are a few things I would like
to explain.
The program in EXAMPLE1.Amos used seven lines for the actual code as we
should now understand these commands it would be nice to squash them all
up on one line. We can do this easily by using a colon (:) between each
command like this:
CURS OFF: HIDE: PAPER 0: CLS 0: PRINT "Testing...": WAIT KEY: EDIT
This will work exactly the same as the program in Example1.Amos.
This is not regarded as good programming practice by purists as it can make
long programs run a frame or two slower and can make listings a bit
confusing to follow, but the choice is yours. Personally, I have no
preference either way.
Something else you will have come across is the REM statement. REM is short
for REMark and serves as a good description of it's use. As Amos ignores
ANYTHING after a REM you can use it to put REMarks and comments in your
program listings.
REM tells Amos not to bother about the rest of that particular line
For example:
REM I can put want I want here with no worries
You can even use REM at the end of a line of instructions like this:
CURS OFF: REM wibble wibble rhubarb
But you cannot do this:
CURS OFF: REM CLS 0
Well you can do it, but Amos will never execute the CLS 0 instruction, it
will think CLS 0 is a comment of yours.
If you are not impressed with REM then you can use ` instead:
` I can put anything I want here with no worries
But you cannot use an apostrophe like this
CURS OFF ` this will cause a syntax error
CURS OFF: 'So will this! :CLS 3
What, you may ask is all the fuss about REM and ` ? As they don`t seem to do
a lot? Well, just observe my comments in the example programs and it will
soon become clear how useful commenting a program can be, especially in
complex programs where you have to keep track of lots of variables, ha!
That's a nice link to chapter three where we learn about variables amongst
other things.
Time to LOAD up EXAMPLE2.Amos and mess around with the listing. Although
it's the same boring program as Example1.Amos I urge you to take a quick
peek, just to make everything very clear in your mind about REM and '.
Don`t forget to take notes on everything you learn.
End of chapter two
^^^^^^^^^^^^^^^^^^